// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UIBridgeApplication.cs" company="Open Trader">
//   Copyright (c) David Denis (david.denis@systemathics.com)
// </copyright>
// <summary>
//   |  Open Trader - The Open Source Systematic Trading Platform
//   |
//   |  This program is free software: you can redistribute it and/or modify
//   |  it under the terms of the GNU General Public License as published by
//   |  the Free Software Foundation, either version 2 of the License, or
//   |  (at your option) any later version.
//   |
//   |  This program is distributed in the hope that it will be useful,
//   |  but WITHOUT ANY WARRANTY; without even the implied warranty of
//   |  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   |  GNU General Public License for more details.
//   |
//   |  You should have received a copy of the GNU General Public License
//   |  along with this program.  If not, see http://www.gnu.org/licenses
//   |
//   |  Up to date informations about Open Trader can be found at :
//   |    http://opentrader.org
//   |    http://opentrader.codeplex.com
//   |
//   |  For professional services, please visit us at :
//   |    http://www.systemathics.com
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Org.OpenTrader.Framework.Forge.UI.Forms
{
    #region Using Directives

    using System;

    using Org.OpenTrader.Framework.Enums;
    using Org.OpenTrader.Framework.UI.Forms;

    #endregion

    /// <summary>
    /// The ui bridge application.
    /// </summary>
    public partial class UIBridgeApplication : UIRootControl
    {
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="UIBridgeApplication"/> class.
        /// </summary>
        public UIBridgeApplication()
        {
            this.InitializeComponent();
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="UIBridgeApplication"/> class.
        /// </summary>
        /// <param name="name">
        /// The name.
        /// </param>
        public UIBridgeApplication(string name)
            : base(name)
        {
            this.InitializeComponent();
        }

        #endregion

        #region Methods

        /// <summary>
        /// The display or hider control.
        /// </summary>
        /// <param name="name">
        /// The name.
        /// </param>
        private void DisplayOrHiderControl(string name)
        {
            var ctrl = this.GetControl(name);
            if (ctrl != null)
            {
                ctrl.ContainingForm.Visibility = EUIFormVisibility.Invert;
            }
        }

        /// <summary>
        /// The buttonDictionary_ click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void OnButtonDictionaryClick(object sender, EventArgs e)
        {
            this.DisplayOrHiderControl("DictionaryService");
        }

        /// <summary>
        /// The buttonFeed_ click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void OnButtonFeedClick(object sender, EventArgs e)
        {
            this.DisplayOrHiderControl("FeedService");
        }

        /// <summary>
        /// The buttonOrder_ click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void OnButtonOrderClick(object sender, EventArgs e)
        {
            this.DisplayOrHiderControl("OrderService");
        }

        #endregion
    }
}